home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / smixw130.zip / LOWMEM.C < prev    next >
C/C++ Source or Header  |  1997-06-06  |  1KB  |  46 lines

  1. /*      SMIXW is Copyright 1995 by Ethan Brodsky.  All rights reserved.     */
  2. /* ██ lowmem.c ████████████████████████████████████████████████████████████ */
  3.  
  4. /* ════════════════════════════════════════════════════════════════════════ */
  5.  
  6. void dos_memalloc(short int para, short int *seg, short int *sel);
  7. #pragma  aux dos_memalloc = \
  8.   "push  ecx"               \
  9.   "push  edx"               \
  10.   "mov   ax, 0100h"         \
  11.   "int   31h"               \
  12.   "pop   ebx"               \
  13.   "mov   [ebx], dx"         \
  14.   "pop   ebx"               \
  15.   "mov   [ebx], ax"         \
  16.   parm   [bx] [ecx] [edx]   \
  17.   modify [ax ebx ecx edx];
  18.  
  19. /* ──────────────────────────────────────────────────────────────────────── */
  20.  
  21. void dos_memfree(short int sel);
  22. #pragma  aux dos_memfree =  \
  23.   "mov   ax, 0101h"         \
  24.   "int   31h"               \
  25.   parm   [dx]               \
  26.   modify [ax dx];
  27.  
  28. /* ════════════════════════════════════════════════════════════════════════ */
  29.  
  30. void *low_malloc(int size, short int *sel)
  31.   {
  32.     short int seg;
  33.  
  34.     dos_memalloc((size >> 4) + 1, &seg, sel);
  35.     return((char *)(seg << 4));
  36.   }
  37.  
  38. /* ──────────────────────────────────────────────────────────────────────── */
  39.  
  40. void low_free(short int sel)
  41.   {
  42.     dos_memfree(sel);
  43.   }
  44.  
  45. /* ████████████████████████████████████████████████████████████████████████ */
  46.